package frontend

import (
	"blog/service/page"
	"net/http"

	"gitee.com/xchengli/blog-lib/zlog"

	"github.com/gin-gonic/gin"
)

/*
*
关于
*/
func AboutHandle(ctx *gin.Context) {
	type Data struct {
		Abouts   interface{}
		PageName string
	}
	var err error
	var D Data
	D.PageName = "关于"

	// 调用 ps 层
	optPageService := page.NewOptPageService()
	abouts, err := optPageService.GetAllAbout(ctx)
	if err != nil {
		zlog.ErrorW(ctx, "aboutPageGetAllAboutFailed", "err", err.Error())
		ctx.HTML(http.StatusInternalServerError, "error.html", gin.H{
			"title": "页面出错",
			"error": "获取内容出错 : " + err.Error(),
		})
		return
	}

	D.Abouts = abouts

	ctx.HTML(http.StatusOK, "about.html", D)
}
